﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DAL
{
  public  class Delete
    {
        /// <summary>
        /// 删除表的特定内容
        /// </summary>
        public static int DeleteOne(string table, int ID)
        {
            string sql = string.Format("delete from " + table + " where ID=@ID");
            SqlParameter[] parameters = {
                                            new SqlParameter("ID", SqlDbType.Int)
                                        };
            parameters[0].Value = ID;

            Utility.SQLHelper db = new Utility.SQLHelper();
            return db.ExecuteNonQuery(sql, parameters, CommandType.Text);
        }
        public static int DeleteSome(string table, int Para)
        {
            string sql = string.Format("delete from " + table + " where datediff(dd,Time,GETDATE()) >= @Para");
            SqlParameter[] parameters = {
                                            new SqlParameter("Para", SqlDbType.Int)
                                        };
            parameters[0].Value = Para;

            Utility.SQLHelper db = new Utility.SQLHelper();
            return db.ExecuteNonQuery(sql, parameters, CommandType.Text);
        }
    }
}
